package com.wangsd.common.mq;

import com.wangsd.common.constant.MqConstant;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * 指定消息队列
 */
@Component
public class MqSend {

    @Autowired
    AmqpTemplate amqpTemplate;

    //查询订单处理结果
    public void sendOrderQuery(Long orderId) {
        this.amqpTemplate.convertAndSend(MqConstant.RABBITMQ_FACEPAY_ORDER_QUERY, orderId);
    }

    //处理会员信息
    public void sendCheckIsMember(Long merchandId, String openId, String subOpenId, String phone, Integer isSend, Long orderId, String payType) {
        CheckMember checkMember = new CheckMember();
        checkMember.setMerchandId(merchandId);
        checkMember.setOpenId(openId);
        checkMember.setIsSend(isSend);
        checkMember.setOrderId(orderId);
        checkMember.setPhone(phone);
        checkMember.setSubOpenId(subOpenId);
        checkMember.setPayType(payType);
        this.amqpTemplate.convertAndSend(MqConstant.RABBITMQ_FACEPAY_IS_MEMBER, checkMember);
    }
}
